<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="h" uri="/syzg-html"%>
<!DOCTYPE html>
<html>
<body>
<div class="modal fade bs-example-modal-lg" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">修改操作信息</h4>
      </div>
      <div class="modal-body" id="modalCore">
        <form class="form-horizontal" role="form" id="aeForm" name="aeForm">
          <fieldset>
          <input type="hidden" name="id" value="${operation.id}"/>
            <!-- generate code start -->

            <div class="form-group">
              <label class="col-sm-2 control-label" for="code">模块</label>
              <div class="col-sm-3">
                <select name="module.id" id="module.id" class="form-control">
              	  <c:forEach items="${moduleList }" var="module">
              		<option value="${module.id }" <c:if test="${module.id==operation.module.id }">selected</c:if>>${module.name }</option>
              	  </c:forEach>
              	</select>
              </div>

              <label class="col-sm-2 control-label" for="name">排序</label>
              <div class="col-sm-3">
                <input type="text" id="orderNo" name="orderNo" value="${operation.orderNo}" class="form-control" />
              </div>
            </div>
            
            <div class="form-group">
              <label class="col-sm-2 control-label" for="code">模块编码</label>
              <div class="col-sm-3">
                <input type="text" id="code" name="code" value="${operation.code}" class="form-control" />
              </div>

              <label class="col-sm-2 control-label" for="name">名称</label>
              <div class="col-sm-3">
                <input type="text" id="name" name="name" value="${operation.name}" class="form-control" />
              </div>
            </div>

			<!-- generate code end -->
          </fieldset>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" onclick="submitSave('edit');">保存</button>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$('#aeForm').bootstrapValidator({
  message: 'This value is not valid',
  feedbackIcons: {
      valid: 'glyphicon glyphicon-ok',
      invalid: 'glyphicon glyphicon-remove',
      validating: 'glyphicon glyphicon-refresh'
  },
  fields: {
	  code: {
    	  group: '.col-sm-3',
          message: '请输入正确的格式',
          validators: {
              notEmpty: {
                  message: '操作代码不能为空'
              }
          }
      },
      name: {
    	  group: '.col-sm-3',
          message: '请输入正确的格式',
          validators: {
              notEmpty: {
                  message: '操作名称不能为空'
              }
          }
      },
      orderNo: {
    	  group: '.col-sm-3',
          message: '请输入正确的格式',
          validators: {
              notEmpty: {
                  message: '排序不能为空'
              },regexp: {
                  regexp: /^[1-9]\d*$/,
                  message: '排序必须为正整数'
              }
          }
      }
  	}
}).on('success.form.bv', function(e, data) {
	FormFunction.submitSave('edit');
});
</script>
</body>
</html>
